Tooltip migration: boot consumers + shell-level Tooltip.Provider (5/5)#78692
Tooltip migration: boot consumers + shell-level Tooltip.Provider (5/5)#78692ciampo wants to merge 1 commit into
Conversation
…ended Now that the in-repo migration of `Tooltip` consumers from `@wordpress/components` to `@wordpress/ui` is complete (PRs #78411, #78466, #78470, #78691, #78692), this PR flips the recommendation: - `@wordpress/eslint-plugin` (`use-recommended-components`): - Adds `Tooltip` to the `@wordpress/ui` allow-list. - Adds a `Tooltip` entry to the `@wordpress/components` deny-list pointing to `Tooltip` from `@wordpress/ui`. - `@wordpress/components` Storybook story: flips `componentStatus.status` from `recommended` to `not-recommended` and adds a `notes` field pointing to `@wordpress/ui`. - `@wordpress/ui` Storybook story: flips `componentStatus.status` from `use-with-caution` to `recommended` and drops the previous compat caveat (resolved by #78441). - Removes the per-import `// eslint-disable-next-line @wordpress/use-recommended-components` directives that were added during the migration in PRs 1-3 (20 files across `block-editor`, `block-directory`, `editor`, `edit-post`, `edit-site`, and `dataviews`). Note: this PR is based on trunk and therefore does NOT yet remove the analogous directives added by PRs 4 and 5 (#78691, #78692). Once those merge, this PR will be rebased and the remaining directives removed in the same commit.
|
Size Change: +32.3 kB (+0.4%) Total Size: 8.21 MB 📦 View Changed
ℹ️ View Unchanged
|
Migrates the two `Tooltip` consumers in `@wordpress/boot` from the legacy `Tooltip` exported by `@wordpress/components` to the compositional `Tooltip` exported by `@wordpress/ui`, and mounts a shell-level `<Tooltip.Provider>` inside `boot/root` so tooltips inside the app coordinate as a group (mirrors PR #78466 for edit-post and edit-site layouts). - `boot/site-icon-link` — codemod-able. Tooltip on the site-icon `Link`, positioned to the right. - `boot/save-button` — migrated by hand because the legacy `shortcut` prop has no equivalent on the new `Tooltip`. The shortcut is rendered inline inside `Tooltip.Popup` via a local `.boot-save-button__shortcut` span (mirroring the legacy `.components-tooltip__shortcut` rule from `@wordpress/components`, but with a local class name to avoid leaking the `components-*` namespace outside `@wordpress/components`). A `TODO` flags the intent to replace this with a future `@wordpress/ui` `Shortcut` primitive once available. `@wordpress/ui` is now declared as a runtime dependency of `@wordpress/boot`. Part 5 of a 5-PR migration series (PRs 1-3 landed: #78411, #78466, #78470; PR 4 is in flight).
c5faea5 to
4f0cb32
Compare
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
There was a problem hiding this comment.
Pull request overview
Final step of the Tooltip migration series for @wordpress/boot, moving remaining consumers from @wordpress/components Tooltip to the compositional @wordpress/ui Tooltip API and adding a shell-level Tooltip.Provider so tooltips coordinate across the app shell.
Changes:
- Migrate
site-icon-linkandsave-buttontooltip call sites to@wordpress/ui’s compositionalTooltip.*API. - Mount a shell-level
<Tooltip.Provider>withinboot/root(insideSlotFillProvider) to coordinate tooltip warmup across the shell. - Add
@wordpress/uias a runtime dependency of@wordpress/boot(plus TS project reference / lockfile updates).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/boot/tsconfig.json | Adds TS project reference to ../ui for the new runtime dependency usage. |
| packages/boot/src/components/site-icon-link/index.tsx | Migrates the site icon tooltip to @wordpress/ui compositional Tooltip with right-side positioning. |
| packages/boot/src/components/save-button/style.scss | Adds local shortcut spacing rule intended to match legacy tooltip shortcut layout. |
| packages/boot/src/components/save-button/index.tsx | Migrates save button tooltip to @wordpress/ui, rendering shortcut inline in Tooltip.Popup. |
| packages/boot/src/components/root/index.tsx | Wraps the boot shell in Tooltip.Provider to coordinate tooltip behavior across the app. |
| packages/boot/package.json | Adds @wordpress/ui as a dependency of @wordpress/boot. |
| package-lock.json | Updates lockfile for the new workspace dependency. |
| // Match the legacy `components-tooltip__shortcut` rule: the shortcut sits | ||
| // to the right of the tooltip label, with a small horizontal gap. When the | ||
| // shortcut is the only child of the Tooltip popup (no label, e.g. in the | ||
| // saved state), the margin is not applied so the shortcut stays flush left. | ||
| .boot-save-button__shortcut:not(:first-child) { | ||
| margin-left: $grid-unit-10; | ||
| } |
|
Flaky tests detected in 4f0cb32. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26521248692
|
What?
Tooltip migration part 5 of 5 (final): migrates the 2
Tooltipconsumers in@wordpress/bootfrom the legacyTooltip(@wordpress/components) to the compositionalTooltip(@wordpress/ui), plus mounts a shell-level<Tooltip.Provider>insideboot/rootso sibling tooltips coordinate as a group (mirrors #78466 foredit-post/edit-site).Sites migrated
boot/components/site-icon-link— codemod output; tooltip on the site-iconLink, positioned to the right.boot/components/save-button— manual migration (the codemod bails on the legacyshortcutprop). The shortcut renders inline insideTooltip.Popupas a local.boot-save-button__shortcutspan; CSS mirrors the legacycomponents-tooltip__shortcutrule (left-margin only when a label sits to its left). An inlineTODOflags a future@wordpress/uiShortcutprimitive.boot/components/root— shell-level<Tooltip.Provider>inside<SlotFillProvider>.5-PR plan
block-editor + block-directory (+ codemod)— Tooltip migration: block-editor + block-directory consumers (1/5) #78411 landededitor + edit-post + edit-site— Tooltip migration: editor + edit-post + edit-site consumers (2/5) #78466 landeddataviews— Tooltip migration: dataviews consumers (3/5) #78470 landedsave-button+ shell-levelTooltip.Provider) ← this PRFollow-ups: codemod cleanup (#78669), mark
Tooltiprecommended (after this PR).Why?
With this PR, all consumers outside
@wordpress/componentsitself are migrated — unlocking the recommendation flip in a follow-up.Out of scope
Call sites inside
@wordpress/components(notablyButton's internal Tooltip andTooltipInternalContext) stay on the legacy implementation — separate follow-up.How?
site-icon-linkwas rewritten by the codemod from #78411; import placement and the per-lineeslint-disabledirective were finished by hand.save-buttonwas done by hand because the codemod intentionally bails on the legacyshortcutprop. The shortcut is rendered as a sibling inside<Tooltip.Popup>with a local class name; CSS replicates the legacymargin-left: $grid-unit-10(gated on:not(:first-child)so a lonely shortcut — in the saved state — stays flush left, mirroring the legacy conditional class).The shell-level
<Tooltip.Provider>sits inside<SlotFillProvider>, matching the placement used byedit-post/edit-siteshells. Once the first tooltip in a session has been shown, subsequent siblings open instantly within the same provider scope.@wordpress/uiwas added as a runtime dependency to@wordpress/boot.Testing Instructions
boot/root).aria-label.Testing Instructions for Keyboard
Keyboard focus on the save button still announces the visible label +
aria-keyshortcuts. The visible tooltip is hover-only — no change vs trunk in keyboard interaction.Screenshots or screencast
Inline review comments on each call site include before/after snapshots where useful.
Use of AI Tools
This PR was authored with assistance from Cursor; the author reviewed and verified all changes.